package signalprocessing;

import ikelib.IntegrateAccelaration;
import ikelib.Median;
import ikelib.PlotColor;
import ikeuilib.JButtonWithMenu;

import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Dimension;
import java.awt.Graphics2D;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.ItemEvent;
import java.awt.event.ItemListener;
import java.util.Iterator;
import java.util.LinkedList;

import javax.swing.DefaultListModel;
import javax.swing.ImageIcon;
import javax.swing.JButton;
import javax.swing.JCheckBox;
import javax.swing.JLabel;
import javax.swing.JList;
import javax.swing.JMenuItem;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JPopupMenu;
import javax.swing.JScrollPane;
import javax.swing.JTextField;
import javax.swing.ListModel;
import javax.swing.UIManager;
import javax.swing.border.EtchedBorder;
import javax.swing.border.TitledBorder;
import javax.swing.event.ListSelectionEvent;
import javax.swing.event.ListSelectionListener;

import wcg.SignalProcessingInterface;
import wcg.stateChangeNotify;



/**
 * 
 */

/**
 * デシメーションを表示する。
 * 
 * @author ikechan
 *
 */
public class PanelDecimation extends SignalProcessingPanelBasic implements stateChangeNotify,SignalProcessingInterface,PlotPanelCollectionInterface
						, PanelControlYScaleInterface,PanelControlXScaleInterface,SignalprocessingPanelInterface {
	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	private JList ListChannel;
	protected PlotPaneCollection PlotCollection=null;
	private JCheckBox chckbxAccelarationraw;
	private JCheckBox chckbxDecimate;

	private JCheckBox chckbxDigit;
	/**
	 * 
	 */
	public PanelDecimation() {
		super();
		setLayout(new BorderLayout(0, 0));
		setPreferredSize(new Dimension(500,500));

		PlotPanel panelIntegration = new PlotPanel(Col);
		add(panelIntegration, BorderLayout.CENTER);
		panelIntegration.setLayout(new BorderLayout(0, 0));

		JPanel panelControlPanelIntegration = new JPanel();
		panelIntegration.add(panelControlPanelIntegration, BorderLayout.WEST);

		panelControlPanelIntegration.setBorder(new EtchedBorder(EtchedBorder.LOWERED, null, null));
		panelControlPanelIntegration.setLayout(null);
		panelControlPanelIntegration.setPreferredSize(new Dimension(210, 600));

		JPanel panelChannelandCalc = new JPanel();
		panelChannelandCalc.setBorder(new TitledBorder(null, "Channel & Calclation", TitledBorder.LEADING, TitledBorder.TOP, null, null));
		panelChannelandCalc.setBounds(7, 14, 189, 159);
		panelControlPanelIntegration.add(panelChannelandCalc);
		panelChannelandCalc.setLayout(null);

		chckbxDecimate = new JCheckBox("Decimate");
		chckbxDecimate.setSelected(true);
		chckbxDecimate.setBounds(74, 52, 87, 21);
		panelChannelandCalc.add(chckbxDecimate);

		chckbxAccelarationraw = new JCheckBox("RAW data");
		chckbxAccelarationraw.setBounds(74, 27, 107, 21);
		panelChannelandCalc.add(chckbxAccelarationraw);
		chckbxAccelarationraw.addItemListener(new ItemListener() {
			public void itemStateChanged(ItemEvent arg0) {
				onConfChange();
			}
		});
		chckbxAccelarationraw.setToolTipText("Display original (accelaration) data.");

		JScrollPane scrollPane = new JScrollPane();
		scrollPane.setBounds(12, 27, 58, 115);
		panelChannelandCalc.add(scrollPane);

		ListChannel = new JList();
		scrollPane.setViewportView(ListChannel);
		ListChannel.addListSelectionListener(new ListSelectionListener() {
			// ＣＨセレクションが変更されたとき
			public void valueChanged(ListSelectionEvent arg0) {
				if(!arg0.getValueIsAdjusting()){
					onConfChange();
				}
			}

		});
		chckbxDecimate.addItemListener(new ItemListener() {
			public void itemStateChanged(ItemEvent arg0) {
				onConfChange();
			}
		});

		/*
		 * Ｙスケールコントロール小パネルを表示する
		 */
		PanelControlYScaleConfiguration confyscale = new PanelControlYScaleConfiguration();
		
		PanelControlYScale panelControlYScale = new PanelControlYScale(confyscale);
		panelControlYScale.setLocation(7, 239);
		panelControlYScale.addParent(this);
		panelControlPanelIntegration.add(panelControlYScale);
		
		
//		JPanel panelTitleAmpScale = new JPanel();
//		panelTitleAmpScale.setBorder(new TitledBorder(UIManager.getBorder("TitledBorder.border"), "Amp. Scale", TitledBorder.LEADING, TitledBorder.TOP, null, new Color(0, 0, 0)));
//		panelTitleAmpScale.setBounds(7, 210, 189, 122);
//		panelControlPanelIntegration.add(panelTitleAmpScale);
//		panelTitleAmpScale.setLayout(null);
//		JButton btnSpanUp = new JButton("");
//		btnSpanUp.setBounds(145, 20, 25, 21);
//		panelTitleAmpScale.add(btnSpanUp);
//		btnSpanUp.setIcon(new ImageIcon(SignalProcessingPanel.class.getResource("/images/wave22-small.png")));
//		JButton btnSpanDown = new JButton("");
//		btnSpanDown.setBounds(145, 54, 25, 21);
//		panelTitleAmpScale.add(btnSpanDown);
//		btnSpanDown.setIcon(new ImageIcon(SignalProcessingPanel.class.getResource("/images/wave22-big.png")));
//		btnAmpAuto = new JButtonWithMenu();
//		btnAmpAuto.setBounds(12, 20, 91, 26);
//		panelTitleAmpScale.add(btnAmpAuto);
//		btnAmpAuto.setText("Auto");
//		JButton btnAmpShiftUp = new JButton("");
//		btnAmpShiftUp.setBounds(117, 54, 25, 21);
//		panelTitleAmpScale.add(btnAmpShiftUp);
//		btnAmpShiftUp.setIcon(new ImageIcon(SignalProcessingPanel.class.getResource("/images/arrow_down.png")));
//		JButton btnAmpShiftDown = new JButton("");
//		btnAmpShiftDown.setBounds(117, 20, 25, 21);
//		panelTitleAmpScale.add(btnAmpShiftDown);
//		btnAmpShiftDown.setIcon(new ImageIcon(SignalProcessingPanel.class.getResource("/images/arrow_up.png")));
//		btnSingle = new JButtonWithMenu();
//		btnSingle.setBounds(12, 49, 91, 26);
//		panelTitleAmpScale.add(btnSingle);
//		btnSingle.setText("Single");
//
//		btnTruncate = new JButtonWithMenu();
//		btnTruncate.setBounds(12, 85, 91, 26);
//		panelTitleAmpScale.add(btnTruncate);
//		btnTruncate.addActionListener(new ActionListener() {
//			public void actionPerformed(ActionEvent arg0) {
//				if(btnTruncate.isClickedDropDown()){
//					JPopupMenu popup=new JPopupMenu();
//					JMenuItem mi = new JMenuItem(" 1.0e-2");
//					mi.addActionListener(new ActionListener(){
//						@Override
//						public void actionPerformed(ActionEvent arg0) {
//							doYSpanTruncate(0);
//						}
//
//					});
//					popup.add(mi);
//
//					JMenuItem mi2 = new JMenuItem("*1.2e-3");
//					mi2.addActionListener(new ActionListener(){
//						@Override
//						public void actionPerformed(ActionEvent arg0) {
//							// 普通は二桁、シフトで１ケタまるめ、
//							doYSpanTruncate(1);
//						}
//
//					});
//					popup.add(mi2);
//
//					JMenuItem mi3 = new JMenuItem(" 1.23e-4");
//					mi3.addActionListener(new ActionListener(){
//						@Override
//						public void actionPerformed(ActionEvent arg0) {
//							doYSpanTruncate(2);
//						}
//
//					});
//					popup.add(mi3);
//
//
//					popup.show(btnSingle,0,btnSingle.getHeight());
//				}
//				else{
//					doYSpanTruncate(1);
//				}
//			}
//		});
//		btnTruncate.setText("Truncate");
//		btnSingle.addActionListener(new ActionListener() {
//			public void actionPerformed(ActionEvent e) {
//				if(btnSingle.isClickedDropDown()){
//					JPopupMenu popup=new JPopupMenu();
//					JMenuItem mi = new JMenuItem("*Single");
//					mi.addActionListener(new ActionListener(){
//						@Override
//						public void actionPerformed(ActionEvent arg0) {
//							doYSpanSingle(0);
//						}
//
//					});
//					popup.add(mi);
//
//					JMenuItem mi3 = new JMenuItem(" Single by group");
//					mi3.addActionListener(new ActionListener(){
//						@Override
//						public void actionPerformed(ActionEvent arg0) {
//							doYSpanSingleGroup(0);
//						}
//
//					});
//					popup.add(mi3);
//
//
//					popup.show(btnSingle,0,btnSingle.getHeight());
//				}
//				else{
//					doYSpanSingle(0);
//				}
//
//			}
//		});
//		btnAmpShiftDown.addActionListener(new ActionListener() {
//			public void actionPerformed(ActionEvent e) {
//				int r=-20;
//				if((e.getModifiers()&ActionEvent.SHIFT_MASK) != 0){
//					r = -100;
//				}
//				doYSpanShift(r);
//			}
//		});
//		btnAmpShiftUp.addActionListener(new ActionListener() {
//			public void actionPerformed(ActionEvent e) {
//				int r=20;
//				if((e.getModifiers()&ActionEvent.SHIFT_MASK) != 0){
//					r = 100;
//				}
//				doYSpanShift(r);
//			}
//		});
//		btnAmpAuto.addActionListener(new ActionListener() {
//			public void actionPerformed(ActionEvent e) {
//				if(btnAmpAuto.isClickedDropDown()){
//					JPopupMenu popup=new JPopupMenu();
//					JMenuItem mi = new JMenuItem("*Zero centered");
//					mi.addActionListener(new ActionListener(){
//						@Override
//						public void actionPerformed(ActionEvent arg0) {
//							doYSpanAuto(PlotPane.ScaleAuto_FITCenter);
//						}
//
//					});
//					popup.add(mi);
//
//					JMenuItem mi2 = new JMenuItem(" Fit max-min");
//					mi2.addActionListener(new ActionListener(){
//						@Override
//						public void actionPerformed(ActionEvent arg0) {
//							doYSpanAuto(PlotPane.ScaleAuto_FITMaxMin);
//						}
//
//					});
//					popup.add(mi2);
//					popup.show(btnAmpAuto,0,btnAmpAuto.getHeight());
//				}
//				else{
//					doYSpanAuto(PlotPane.ScaleAuto_FITCenter);
//				}
//
//			}
//		});
//		btnSpanDown.addActionListener(new ActionListener() {
//			public void actionPerformed(ActionEvent e) {
//				int r = 50;
//				if((ActionEvent.SHIFT_MASK & e.getModifiers()) !=0){
//					r = 10;
//				}
//				doYSpan(r);
//			}
//		});
//		btnSpanUp.addActionListener(new ActionListener() {
//			public void actionPerformed(ActionEvent e) {
//				int r = 200;
//				if((ActionEvent.SHIFT_MASK & e.getModifiers()) !=0){
//					r = 1000;
//				}
//				doYSpan(r);
//			}
//		});

		/*
		 * Xスケールコントロール小パネルを表示する
		 */
		PanelControlXScaleConfiguration confx  = new PanelControlXScaleConfiguration();
		confx.TruncateButton = false;
		PanelControlXScale panelControlXScale = new PanelControlXScale(confx);
		panelControlXScale.setLocation(7, 371);
		panelControlXScale.addParent(this);
		panelControlPanelIntegration.add(panelControlXScale);
		
		JPanel panelDisplay = new JPanel();
		panelDisplay.setBorder(new TitledBorder(null, "Display", TitledBorder.LEADING, TitledBorder.TOP, null, null));
		panelDisplay.setBounds(7, 179, 191, 57);
		panelControlPanelIntegration.add(panelDisplay);
				
				chckbxDigit = new JCheckBox("Digit");
				chckbxDigit.setBounds(8, 24, 70, 21);
				chckbxDigit.addActionListener(new ActionListener() {
					public void actionPerformed(ActionEvent e) {
						onConfChange();
					}
				});
				panelDisplay.setLayout(null);
				panelDisplay.add(chckbxDigit);
				chckbxDigit.setSelected(true);
		
				// とりあえず全部を強制的に再描画するボタン
				JButton btnRepaint = new JButton("ReDraw");
				btnRepaint.setBounds(86, 24, 93, 21);
				panelDisplay.add(btnRepaint);
				btnRepaint.addActionListener(new ActionListener() {
					public void actionPerformed(ActionEvent arg0) {
						repaintAllComponent();
					}
				});


		/**
		 * グラフプロット領域を作成
		 */
		PlotPanelCollectionConfiguration conf = new PlotPanelCollectionConfiguration();
		PlotCollection = new PlotPaneCollection(Col,conf);
		panelIntegration.add(PlotCollection, BorderLayout.CENTER);
		PlotCollection.setUp(this,AccViewCh,Plot,Col);

		
//		
//		JPanel panelTitleTimeScale = new JPanel();
//		panelTitleTimeScale.setBorder(new TitledBorder(UIManager.getBorder("TitledBorder.border"), "Time Scale", TitledBorder.LEADING, TitledBorder.TOP, null, new Color(0, 0, 0)));
//		panelTitleTimeScale.setBounds(7, 342, 189, 105);
//		panelControlPanelIntegration.add(panelTitleTimeScale);
//		panelTitleTimeScale.setLayout(null);
//		JButton btnTimeShiftInc = new JButton("");
//		btnTimeShiftInc.setBounds(145, 59, 25, 25);
//		panelTitleTimeScale.add(btnTimeShiftInc);
//		btnTimeShiftInc.setIcon(new ImageIcon(SignalProcessingPanel.class.getResource("/images/arrow_right.png")));
//		JButton btnTimeShiftDec = new JButton("");
//		btnTimeShiftDec.setBounds(117, 59, 25, 25);
//		panelTitleTimeScale.add(btnTimeShiftDec);
//		btnTimeShiftDec.setIcon(new ImageIcon(SignalProcessingPanel.class.getResource("/images/arrow_left.png")));
//
//		JButton btnTimeSpanZoomOut = new JButton("");
//		btnTimeSpanZoomOut.setBounds(145, 23, 25, 25);
//		panelTitleTimeScale.add(btnTimeSpanZoomOut);
//		btnTimeSpanZoomOut.setIcon(new ImageIcon(SignalProcessingPanel.class.getResource("/images/wave-zoomout.png")));
//
//		JButton btnTimeSpanZoomIn = new JButton("");
//		btnTimeSpanZoomIn.setBounds(117, 23, 25, 25);
//		panelTitleTimeScale.add(btnTimeSpanZoomIn);
//		btnTimeSpanZoomIn.setIcon(new ImageIcon(SignalProcessingPanel.class.getResource("/images/wave-zoomin.png")));
//		JButton btnAutoSpan = new JButton("Full");
//		btnAutoSpan.setBounds(12, 23, 93, 25);
//		panelTitleTimeScale.add(btnAutoSpan);
//		
//
//		btnTimeSpanZoomIn.addActionListener(new ActionListener() {
//			public void actionPerformed(ActionEvent e) {
//				int r = -20;
//				if((ActionEvent.SHIFT_MASK & e.getModifiers()) !=0){
//					r = -90;
//				}
//				doTSpanZoom(r);
//			}
//		});
//		btnTimeSpanZoomOut.addActionListener(new ActionListener() {
//			public void actionPerformed(ActionEvent e) {
//				int r = 20;
//				if((ActionEvent.SHIFT_MASK & e.getModifiers()) !=0){
//					r = 90;
//				}
//				doTSpanZoom(r);
//			}
//		});
//		btnTimeShiftDec.addActionListener(new ActionListener() {
//			public void actionPerformed(ActionEvent e) {
//				int r = -20;
//				if((ActionEvent.SHIFT_MASK & e.getModifiers()) !=0){
//					r = -100;
//				}
//				doTShift(r);
//			}
//		});
//		btnTimeShiftInc.addActionListener(new ActionListener() {
//			public void actionPerformed(ActionEvent e) {
//				int r = 20;
//				if((ActionEvent.SHIFT_MASK & e.getModifiers()) !=0){
//					r = 100;
//				}
//				doTShift(r);
//			}
//
//		});
//		

		{
			//addChannelPanel(0);	// test
		}
		initial();

	}
	/**
	 * チャンネルリストの選択ＣＨ・全ＣＨを得る
	 * @param selected　true=選択ＣＨ、false=全ＣＨ
	 * @return
	 */
	private Integer[] getChannelList(boolean selected){
		if(ListChannel==null) return null;
		ListModel model = ListChannel.getModel(); //@
		int max = model.getSize();
		LinkedList<Integer> lst = new LinkedList<Integer>();
		for(int i=0;i<max;i++){
			boolean disp = ListChannel.isSelectedIndex(i);
			String ms = (String)ListChannel.getModel().getElementAt(i);
			int ch = Integer.valueOf(ms,16);	
			if(selected && disp){
				lst.add(ch);
			}
			else if(!selected){
				lst.add(ch);
			}
		}
		Integer[] ret = lst.toArray(new Integer[0]);
		if(lst.size()<=0) return null;
		return ret;
	}


	protected void onViewChange(){ 
		repaintAllComponent();
	}
	enum CalcType { RAW, DECIMATION , Accelaration, Velocity , Displacement };
	private static final int CALCTYPE_RAW 				= 0x01 << 0;
	private static final int CALCTYPE_DECIMATE 			= 0x01 << 1;
	private JButtonWithMenu btnAmpAuto;
	private JButtonWithMenu btnSingle;
	private JButtonWithMenu btnTruncate;

	/**
	 * 計算オプションを表す ＩＤを得る
	 * @return
	 */
	private Integer[] getSubId(boolean getAllOption){
		LinkedList<Integer> lst = new LinkedList<Integer>();
		if(chckbxAccelarationraw==null) return null;
		if(chckbxAccelarationraw.isSelected() || getAllOption){
			lst.add(CALCTYPE_RAW);
		}
		if(chckbxDecimate==null) return null;
		if(chckbxDecimate.isSelected()|| getAllOption){
			lst.add(CALCTYPE_DECIMATE);
		}
		if(lst.size()<=0) return null;
		Integer[] ret = lst.toArray(new Integer[0]);
		return ret;
	}

	/**
	 *  1つのＣＨのグラフエリアを生成する。
	 * @param Panel_Channels
	 * @param id
	 */
	private void addChannelPanel(int id,int subid) {

		if(subid ==0) return;

		double[] data=null;
		if(chckbxDigit.isSelected()){
			data = getChannelRawData(id,1.0);
		}
		else{
			data = getChannelRawData(id,1.0);
		}
		
		if(data == null){
			//System.out.println("fail to getChannelRawData: SignalProcessingPain " + id + subid);
			String mes = String.format("No data found for CH = %04x", id);
			JOptionPane.showMessageDialog(null, "No data found" + mes, mes,  JOptionPane.ERROR_MESSAGE, null);
			return;
		}
		int samplerate=getRawSampleRate(id);;
		if(0 != (subid & CALCTYPE_RAW)){
			samplerate = getRawSampleRate(id);
			if(samplerate<=0) return;
			String name = getDisplayName(CalcType.RAW);
			//addChannelPanel(Panel_Channels,id | CALCTYPE_RAW<<16 ,name, data, samplerate);
			PlotCollection.addChannelPanel(id | CALCTYPE_RAW<<16 ,name, data, samplerate,Data);
		}
		if(0 != (subid & CALCTYPE_DECIMATE)){
			// TODO: Decimationの種類をそのうち増やすこと
			samplerate = getRawSampleRate(id);
			if(samplerate<=0) return;
			Median med =  new Median(samplerate);
			Double[] in = new Double[data.length];
			for(int i=0;i<data.length;i++) in[i] = data[i];
			LinkedList<Double> r= med.decimate(in);
			Double[] t = r.toArray(new Double[1]);
			data = new double[t.length];
			for(int i=0;i<data.length;i++) data[i] = t[i];
			samplerate = 1;
			String name = getDisplayName(CalcType.DECIMATION);
			//addChannelPanel(Panel_Channels,id | CALCTYPE_DECIMATE<<16, name, data, samplerate);
			PlotCollection.addChannelPanel(id | CALCTYPE_DECIMATE<<16, name, data, samplerate,Data);
		}
	}
	/**
	 * ＣＨリストをセットする
	 */
	public void doGetChannel(){
		ListChannel.removeAll();
		DefaultListModel model = new DefaultListModel(); //@
		//Iterator<Integer> ite = Data.getChannel().iterator();
		Iterator<Integer> ite = Data.iteratorChannel();
		while(ite.hasNext()){
			int ch = ite.next();
			String channel = new String();
			channel=String.format("%01X%01X%01X%01X", (ch>>12)&0xf,(ch>>8)&0xf,(ch>>4)&0xf,(ch>>0)&0xf);
			model.addElement(channel);
		}
		ListChannel.setModel(model);
	}
	private void initial(){
		Col.setColorMode(PlotColor.COLOR_COLOR_BLACK_BACK);
	}
	/**
	 * @param type
	 * @return
	 */
	private String getDisplayName(CalcType type) {
		String name = new String();
		switch(type){
		case RAW:
			name = "Accelaration(RAW)";
			break;
		case DECIMATION:
		default:
			name = "Accelaration(Decimated)";
			break;
		}
		return name;
	}
	/* (non-Javadoc)
	 * @see stateChangeNotify#onStateChange(int)
	 */
	@Override
	public void onStateChange(int hint) {

	}


	/**
	 * すべてのコンポーネントを再描画させる。
	 */
	@Override
	public void repaintAllComponent(){
		PlotCollection.repaintAllComponent();
	}


	/**
	 * @return
	 */
	public Dimension getPanelViewSize() {
		return PlotCollection.getSize();
	}

	/**
	 * @param g
	 */
	public void panelViewprintAll(Graphics2D g) {
		PlotCollection.paintAll(g);
	}

	/**
	 * @param colorColorBlackBack
	 */
	public void setColorMode(int colorColorBlackBack) {
		Col.setColorMode(colorColorBlackBack);

	}
	/* (non-Javadoc)
	 * @see SignalProcessingPanelBasic#updateChannel()
	 */
	@Override
	public void updateChannel() {
		Integer[] sel2 = getChannelList(true);		// すべてのＣＨ
		Integer[] sel = getChannelList(false); 		// 選択されているＣＨ
		Integer[] subid = getSubId(true); 			// すべてのオプションを得る
		Integer[] subid2 = getSubId(false); 		// 選択されているオプションを得る
		if(PlotCollection != null){
			PlotCollection.onUpdateChannelMultiPlot(sel,sel2,subid2,subid);
			revalidate();
		}
	}
	/* (non-Javadoc)
	 * @see PlotPanelCollectionInterface#onSetData(int, int)
	 */
	@Override
	public boolean onSetData(int id, int subid) {
		addChannelPanel(id,subid);
		return true;
	}
	/* (non-Javadoc)
	 * @see PlotPanelCollectionInterface#onInitView(int)
	 */
	@Override
	public boolean onInitView(int hint) {
		doYSpanAuto(PlotPane.ScaleAuto_FITCenter);
		onViewChange();
		
		return true;
	}
	/* (non-Javadoc)
	 * @see PlotPanelCollectionInterface#onSetData(java.lang.Integer[])
	 */
	@Override
	public boolean onSetData(Integer[] a) {
		return false;
	}
	/* (non-Javadoc)
	 * @see signalprocessing.PanelControlXScaleInterface#xSpanZoom(int)
	 */
	@Override
	public void xSpanZoom(int ratio) {
		doTSpanZoom(ratio);
		
	}
	/* (non-Javadoc)
	 * @see signalprocessing.PanelControlXScaleInterface#xShift(int)
	 */
	@Override
	public void xShift(int ratio) {
		doTShift(ratio);
		
	}
	/* (non-Javadoc)
	 * @see signalprocessing.PanelControlXScaleInterface#xSpanFull()
	 */
	@Override
	public void xSpanFull() {
		doTSpanAuto();
	}
	/* (non-Javadoc)
	 * @see signalprocessing.PanelControlXScaleInterface#xSpanTruncate(int)
	 */
	@Override
	public void xSpanTruncate(int mode) {
	}
	/* (non-Javadoc)
	 * @see signalprocessing.PanelControlYScaleInterface#ySpanTruncate(int)
	 */
	@Override
	public void ySpanTruncate(int digit) {
		doYSpanTruncate(digit);
	}
	/* (non-Javadoc)
	 * @see signalprocessing.PanelControlYScaleInterface#ySpanSingle(int)
	 */
	@Override
	public void ySpanSingle(int mode) {
		doYSpanSingle(mode);
		
	}
	/* (non-Javadoc)
	 * @see signalprocessing.PanelControlYScaleInterface#ySpanAuto(int)
	 */
	@Override
	public void ySpanAuto(int mode) {
		doYSpanAuto(mode);
		
	}
	/* (non-Javadoc)
	 * @see signalprocessing.PanelControlYScaleInterface#ySpanShift(int)
	 */
	@Override
	public void ySpanShift(int ratio) {
		doYSpanShift(ratio);
	}
	/* (non-Javadoc)
	 * @see signalprocessing.PanelControlYScaleInterface#ySpanSingleGroup(int)
	 */
	@Override
	public void ySpanSingleGroup(int mode) {
		doYSpanSingleGroup(mode);
	}
	/* (non-Javadoc)
	 * @see signalprocessing.PanelControlYScaleInterface#ySpan(int)
	 */
	@Override
	public void ySpan(int ratio) {
		doYSpan(ratio);
	}
	/* (non-Javadoc)
	 * @see signalprocessing.PanelControlYScaleInterface#ySpan(double, double)
	 */
	@Override
	public void ySpan(double max, double min) {
		doYSpan(max,min);
	}
	
}
